<style>
    .token{word-break: break-all;}
</style>
<div class="panel panel-default">
    <div class="panel-body">
            <div class="row">
                <div class="col-md-6">
                    <i class="label label-default">类型</i>
                    <a class="label {{if ne $.userID `0`}}label-danger{{else}}label-default{{end}}" href="/web/client/list">用户</a>
                    <a class="label {{if eq $.userID `0`}}label-danger{{else}}label-default{{end}}" href="/web/client/list?user_id=0">系统</a>
                </div>
                {{if ne $.userID "0"}}
                <div class="col-md-3 pull-right">
                    <form action="/web/client/list" method="get">
                        <div class="input-group">
                            <input class="form-control" name="user_id" type="text" placeholder="UserID">
                            <span class="input-group-btn">
                                <button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-search"></i></button>
                            </span>
                        </div>
                    </form>
                </div>
                {{end}}
            </div>
    </div>
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th class="center w10p">ID</th>
                    <th class="center w10p">名称</th>
                    <th class="center w20p">Token</th>                   
                    <th class="center w10p">{{if ne $.userID "0"}}UserID{{else}}类型{{end}}</th>
                    {{if eq $.userID "0"}}
                    <th class="center w15p">本地网络</th>
                    <th class="center w15p">创建时间</th>
                    <th class="center">操作</th>
                    {{else}}
                    <th class="center w15p">创建时间</th>
                    {{end}}
                </tr>
            </thead>
            <tbody>
                {{range $client := .clients}}
                <tr>
                    <td class="center">{{$client.client_id}}</td>
                    <td class="center">{{$client.name}}</td>
                    <td class="center token">{{$client.token}}</td>
                    <td class="center">
                        {{if eq $client.user_id "0"}} <span class="label label-info">系统</span> {{else}} {{$client.user_id}} {{end}}
                    </td>
                    {{if eq $client.user_id "0"}}
                    <td class="center">{{$client.local_host}}:{{$client.local_port}}</td>
                    <td class="center">
                            {{dateFormat $client.create_time "Y-m-d H:i:s"}}
                    </td>
                    <td class="center">
                        <a name="edit" href="/web/client/edit?client_id={{$client.client_id}}"><i class="glyphicon glyphicon-pencil"> </i>修改</a>
                        <a data-toggle="confirmation" data-placement="left" data-title="确定重置token吗?(Client会被下线)" href="/web/client/reset?client_id={{$client.client_id}}"><i class="glyphicon glyphicon-refresh"> </i>重置</a>
                        <a name="delete" data-toggle="confirmation" data-placement="left" data-title="确定删除吗?" href="/web/client/delete?client_id={{$client.client_id}}"><i class="glyphicon glyphicon-remove"> </i>删除</a>
                    </td>
                    {{else}}
                    <td class="center">
                            {{dateFormat $client.create_time "Y-m-d H:i:s"}}
                    </td>
                    {{end}}
                </tr>
                {{end}}
            </tbody>
        </table>
    </div>
    <div class="panel-footer pagebar">
        <div class="pull-right">{{str2html .page}}</div>
        <div style="clear:both;"></div>
    </div>
</div>